<template>
	<el-dialog :visible.sync="dialogVisible" title="发货信息" width="800px" v-drag2anywhere>
		<el-form :model="formData" ref="form" label-width="90px" >
			<el-row>
        <el-col :span="8">
        	<el-form-item label="采购时间:">{{formData.reqdate}}</el-form-item>
        </el-col>
        <el-col :span="10">
        	<el-form-item label="供应商:">{{formData.seller}}</el-form-item>
        </el-col>
        <el-col :span="6">
        	<el-form-item label="客户名称:">{{formData.client}}</el-form-item>
        </el-col>
        <el-col :span="8">
        	<el-form-item label="采购途径:">{{formData.buyroute}}</el-form-item>
        </el-col>
        <el-col :span="10">
        	<el-form-item label="店铺名称:">
            <span style="margin-right: 10px;">{{formData.shopname}}</span> <a :href="formData.shopurl" v-if="formData.shopurl!=''" target="_blank"><i class="el-icon-link"></i></a>
            </el-form-item>
        </el-col>
			</el-row>
			<el-row>
				<el-col :span="8">
					<el-form-item label="物流名称:" prop="name">
            {{formData.deliver.name}}
           </el-form-item>
				</el-col>
        <el-col :span="16">
        	<el-form-item label="物流单号:" prop="num">
             {{formData.deliver.num}}
          </el-form-item>
        </el-col>
        <el-col >
        	<el-form-item label="物流备注:">
            {{formData.deliver.memo}}
          </el-form-item>
        </el-col>
			</el-row>
		</el-form>
		<div slot="footer" class="dialog-footer">
			<el-button type="primary" size="medium" @click="dialogVisible=false">确定</el-button>
		</div>
	</el-dialog>
</template>

<script>
	export default {
		data() {
			return {
				index: -1,
				formData: {
					orderdate: '',
					ordercode: '',
					type: 1,
					deliver:{
            name:'',
            num:'',
            memo:'',
            status:0
          }
				},
 				dialogVisible: false,

				postlist: []
			}
		},
		methods: {
			init(index, data) {
				this.index = index;
				this.formData = data;
			},
      handleSave(){
        const params={
          id:this.formData.id,
          name:this.formData.deliver.name,
          num:this.formData.deliver.num,
          status:this.formData.deliver.num!=""? 1:0,
          memo:this.formData.deliver.memo
        }
         this.axios.post("api/admin/buylist/updatedeliver",params).then(res=>{
            if(res.status==200 && res.data.code){
              this.$message.success({
                message: res.data.msg,
                duration: 1500,
                showClose: true
              });
              this.dialogVisible=false;
              this.$emit("updated",this.index,params);
            }else{
              this.$message.error({
                message: res.data.msg,
                duration: 1500,
                showClose: true
              });
            }
         })
      }
		}
	}
</script>

<style>
</style>
